﻿<?php

class Control_Menu_Adminleft extends QUI_Control_Abstract
{
    function render()
    {
        //$ctx = QContext::instance();
        $app = MyApp::instance();
        $menus = $app->currentMenu;

        if (!$menus) return '';

        foreach ($menus as $menuText => $menu) {

            $menuHeader = $menuText;
            $submenuHtml = '';

            if (isset($menu['submenu'])) {
                foreach ($menu['submenu'] as $submenuText => $submenu) {
                    $submenuHtml .= '<li><a href="' . url($submenu['udi']) . '">' . $submenuText . '</a></li>';
                }
            }

            return '<div id=leftMenu>
	<div class="header">'.$menuHeader.'</div>
	<div>' . $submenuHtml . '</div>
</div>';

            break;
        }
    }
}